package com.rao.gmall.feign.search;

import com.rao.gmall.common.result.Result;
import com.rao.gmall.feign.search.fallback.SkuEsFeignClientFallback;
import com.rao.gmall.model.list.Goods;
import com.rao.gmall.model.list.SearchParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @author nzmxfan
 * @create 2021-08-13-19:51
 */
@FeignClient(value = "service-search",fallback = SkuEsFeignClientFallback.class)
@RequestMapping("/es/sku/inner")
public interface SkuEsFeignClient {

    @PostMapping("/onSale")
    Result onSale(@RequestBody Goods goods);

    @PostMapping("/cancelSale/{skuId}")
    Result deleteById(@PathVariable("skuId") Long skuId);

    @PostMapping("/search")
    Map<String, Object> searchGood(@RequestBody SearchParam searchParam);

    @GetMapping("/hotScore/{skuId}")
    Result updateSkuHotScore(@PathVariable("skuId") Long skuId,
                             @RequestParam("hotScore") Long hotScore);
}
